import { http } from "@/utils/http";
import type { ResultProps } from "@/api/user";

export interface SpecificationProp {
  id: number;
  account_id: number;
  business_id: number;
  name: string;
  attr: string;
  note: string;
  delete_status: number;
  update_time: Date;
  create_time: Date;
  thirdRelationList: SpecificationSubProp[];
}

export interface SpecificationSubProp {
  id: number;
  account_id: number;
  business_id: number;
  third_value: string;
  autata_value: string;
  autata_content_key: string;
  is_effective: number;

  [key: string]: PropertyKey;
}

export const specificationAdd = (data?: object) => {
  return http.request<ResultProps<SpecificationProp[]>>(
    "post",
    "/specification/add",
    {
      data
    }
  );
};

export const specificationUpdate = (data?: object) => {
  return http.request<ResultProps<SpecificationProp[]>>(
    "post",
    "/specification/upd",
    {
      data
    }
  );
};

export const getSpecificationList = (params?: object) => {
  return http.request<ResultProps<SpecificationProp[]>>(
    "get",
    "/specification/getList",
    {
      params
    }
  );
};

/* specification/del */
export const specificationDelete = (data?: object) => {
  return http.request<ResultProps<any[]>>("post", "/specification/del", {
    data
  });
};

/* export const getMaterialListForFormula = (params?: object) => {
  return http.request<ResultProps<any[]>>("get", "/formula/getDetail", {
    params
  });
}; */
